continue


continue

It is possible to skip one iteration in an instruction for using the instruction continue. This instruction forces the program to skip to the next value in the for. Typically, the instruction continue is used with the instruction if as shown in the program below. In this code, when the value of i is two, the instruction continue force the computer to skip the rest of the instructions in the for. After this, the instruction for executes normally. Thus, the instruction continue forces the next iteration to take place, skipping any code between itself and the conditional expression that controls the for.
Es posible saltarse una iteración en una instrucción for usando la instrucción continue. Esta instrucción obliga al programa a saltarse al próximo valor en el for. Típicamente, la instrucción continue es usada junto con la instrucción if como se muestra en el programa de abajo. En este código, cuando el valor de i es dos, la instrucción continue obliga a la computadora a saltarse al resto de las instrucciones del for. Después de esto, la instrucción for se ejecuta en forma normal. Así, la instrucción continue obliga a que la próxima iteración tome lugar, dejando de ejecutar cualquier código entre el continue y la expressión condicional que controla el for.

continue

Problem 1
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline. Create a Wintempla dialog application called Martin to verify your answer.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea. Cree una aplicación de diálogo de Wintempla llamada Martin para verificar sus resultados.

Martin.cpp
void Martin::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     for(int i = 100; i > 5; i /=2)
     {
          if (i == 25) continue;
          _snwprintf_s(text, 64, _TRUNCATE, L"%d, ", i);
          tbx1.Text += text;
     }
}

VariableTableIText

Problem 2
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea.

Martin.cpp
void Martin::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     for(int i = 100; i > 5; i /=2)
     {
          _snwprintf_s(text, 64, _TRUNCATE, L"%d, ", i);
          tbx1.Text += text;
          if (i == 25) continue;
     }
}

VariableTableIText

Problem 3
Compute the table of variables and the output of the code shown. Suppose there is a textbox called tbx1 with the property of multiline.
Calcule la tabla de variables y la salida del código de abajo. Suponga que hay una caja de texto llamada tbx1 con la propiedad de multilínea.

Martin.cpp
void Martin::Window_Open(Win::Event& e)
{
     wchar_t text[64];
     int i, j = 10;
     for(i = 100; i > 5; i /=2)
     {
          _snwprintf_s(text, 64, _TRUNCATE, L"%d, ", i);
          tbx1.Text += text;
          if (i == 25) continue;
          j++;
     }
     Sys::Format(text, L"\r\ni = %d, j = %d", i, j);
     tbx1.Text += text;
}

VariableTableIJText

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home